def func5(*args):
    print(type(args))  # 输出: <class 'tuple'>
    print(args)        # 输出: (1, 2, 3, 4)
    for a in args:
        print(a)       # 输出: 1 2 3 4

    lst = list(args)
    print(type(lst))   # 输出: <class 'list'>
    print(lst)         # 输出: [1, 2, 3, 4]

# 调用函数
func5(1, 2, 3, 4)

# 解包列表
lst = [1, 2, 3]
func5(*lst)  # 相当于 func5(1, 2, 3)



def func6(**kwargs):
    print(type(kwargs))  # 输出: <class 'dict'>
    print(kwargs)        # 输出: {'a': 1, 'b': 2, 'c': 3}
    for key, value in kwargs.items():
        print(f"{key}: {value}")  # 输出: a: 1 b: 2 c: 3

# 调用函数
func6(a=1, b=2, c=3)

# 解包字典
dict_args = {'a': 1, 'b': 2, 'c': 3}
func6(**dict_args)  # 相当于 func6(a=1, b=2, c=3)



def func7(a, b, *args, **kwargs):
    print(f"a: {a}, b: {b}")
    print(f"args: {args}")
    print(f"kwargs: {kwargs}")

# 调用函数
func7(1, 2, 3, 4, 5, x=6, y=7)




def generic_function(*args, **kwargs):
    for arg in args:
        print(f"Positional argument: {arg}")
    for key, value in kwargs.items():
        print(f"Keyword argument: {key} = {value}")

# 调用函数
generic_function(1, 2, 3, name="Alice", age=30)



